package com.glp.work.flow.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.glp.work.flow.inteface.InsertCheck;
import com.glp.work.flow.inteface.UpdateCheck;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 表单管理DTO
 *
 * @author jhuang1
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class WfFormDTO extends PageDTO implements Serializable {
    private static final long serialVersionUID = 8878187017368640725L;
    /**
     * 表单编号
     */
    @ApiModelProperty(value="表单编号")
    @NotNull(groups = {UpdateCheck.class}, message = "表单编号,不能为空!")
    private Long id;

    /**
     * 表单编号
     */
//    @NotBlank(groups = {InsertCheck.class, UpdateCheck.class}, message = "表单编号,不能为空!")
//    @Length(groups = {InsertCheck.class, UpdateCheck.class}, max = 32, message = "表单编号,不得超过32位")
    @ApiModelProperty(value="表单编号")
    private String formCode;

    /**
     * 表单名称
     */
    @ApiModelProperty(value="表单名称")
    @NotBlank(groups = {InsertCheck.class, UpdateCheck.class}, message = "表单名称,不能为空!")
    @Length(groups = {InsertCheck.class, UpdateCheck.class}, max = 32, message = "表单名称,不得超过32位")
    private String formName;

    /**
     * 表单状态   0:禁用   1:启用
     */
    @ApiModelProperty(value="表单状态   0:禁用   1:启用")
    @NotBlank(groups = {InsertCheck.class, UpdateCheck.class}, message = "表单状态,不能为空!")
    @Pattern(groups = {InsertCheck.class, UpdateCheck.class}, regexp = "[1|0]", message = "表单状态,有误~！")
    private String status;

    /**
     * 创建人
     */
    @ApiModelProperty(value="创建人")
    private String createUser;

    /**
     * 更新人
     */
    @ApiModelProperty(value="更新人")
    private String updateUser;

    /**
     * 创建时间
     */
    @ApiModelProperty(value="创建时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value="更新时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 表单定义内容
     */
    @ApiModelProperty(value="表单定义内容")
    @NotBlank(groups = {InsertCheck.class, UpdateCheck.class}, message = "表单定义,不能为空!")
    private String formContent;

}